<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="resources/css/login2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="resources/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="resources/js/jquery.md5.js"></script>
<script type="text/javascript" src="resources/js/login.js"></script>
<script type="text/javascript">
	function login() {
		
		var userName = $('#u').val();
		var password = $('#p').val();
		
		if(userName==''){
			alert('请输入账号!')
			return
		}
		if(password==''){
			alert('请输入密码!')
			return
		}
		var params = {
			account:userName,
			password:$.md5(password)
		};
		$.ajax({
			type : "POST",
			url : "/sys/user/login.do",
			data : params,
			success : function(msg) {
				if(!msg.success){
					alert(msg.message);
				}else{
					window.location.href='index.jsp'
				}
			}
		});
	}
	function register() {
		var params = {
			userName:$('#user').val(),
			password:$.md5($('#passwd').val()),
			safeQue:$('#safeQue').val(),
			safeAns:$('#safeAns').val()
		};
		$.ajax({
			type : "POST",
			url : "/user/login/register.do",
			data : params,
			success : function(msg) {
				if(!msg.success){
					alert(msg.message);
				}else{
					alert("注册成功!");
					document.getElementById("regUser").reset();
				}
			}
		});
	}
	
	function confirmPasswd(){
		var passwd = $('#passwd').val();
		var passwd2 = $('#passwd2').val();
		if(!(passwd==passwd2)){
			alert('确认密码与密码不一致！')
			$('#passwd2').val('');
		}
	}
</script>
<title>登录</title>
</head>
<!-- <body>
	<div>
		<table>
			<tr>
				<td>用户名：</td>
				<td><input type="text" id="userName" name="userName"></input> </td>
			</tr>
			<tr>
				<td>密码：</td>
				<td><input type="password" id="password" name="password"></input> </td>
			</tr>
			<tr>
				<td><input type="button" onclick="login()" value="登录"></td>
				<td><input type="button" onclick="register()" value="注册"></td>
			</tr>
		</table>
		 
		
			 
	</div> -->

<body onkeypress="if (event.keyCode == 13) login();">
	<h1>快速开发平台</h1>

	<div class="login" style="margin-top: 50px;">

		<div class="web_qr_login" id="web_qr_login"
			style="display: block; height: 235px;">
			<!--登录-->
			<div class="web_login" id="web_login">
				<div class="login-box">
					<div class="login_form">
						<input type="hidden" name="did" value="0" /> <input type="hidden"
							name="to" value="log" />
						<div class="uinArea" id="uinArea">
							<label class="input-tips" for="u">帐号：</label>
							<div class="inputOuter" id="uArea">
								<input type="text" id="u" name="username" class="inputstyle" />
							</div>
						</div>
						<div class="pwdArea" id="pwdArea">
							<label class="input-tips" for="p">密码：</label>
							<div class="inputOuter" id="pArea">
								<input type="password" id="p" name="p" class="inputstyle" />
							</div>
						</div>

						<div style="padding-left: 65px; margin-top: 20px;">
							<input type="submit" value="登 录" onclick="login()"
								style="width: 150px;" class="button_blue" />
						</div>
					</div>

				</div>

			</div>
			<!--登录end-->
		</div>

		<!--注册-->
		<!-- <div class="qlogin" id="qlogin" style="display: none;">

			<div class="web_login">
				<form name="form2" id="regUser">
					<ul class="reg_form" id="reg-ul">
						<li><label for="user" class="input-tips2">账号：</label>
							<div class="inputOuter2">
								<input type="text" id="user" name="user" maxlength="16"
									class="inputstyle2" />
							</div></li>

						<li><label for="passwd" class="input-tips2">密码：</label>
							<div class="inputOuter2">
								<input type="password" id="passwd" name="passwd" maxlength="16"
									class="inputstyle2" />
							</div></li>
						<li><label for="passwd2" class="input-tips2">确认密码：</label>
							<div class="inputOuter2">
								<input type="password" id="passwd2" name="" maxlength="16"
									class="inputstyle2" onblur="confirmPasswd()" />
							</div></li>
						<li>
							<label for="passwd2" class="input-tips2">安全问题：</label>
							<div class="inputOuter2">
								<input type="text" id="safeQue" name="" maxlength="100"
									class="inputstyle2" />
							</div>
						</li>
						<li>
							<label for="passwd2" class="input-tips2">安全答案：</label>
							<div class="inputOuter2">
								<input type="text" id="safeAns" name="" maxlength="100"
									class="inputstyle2" />
							</div>
						</li>
						<li>
							<div class="inputArea">
								<input type="button"
									style="margin-top: 10px; margin-left: 85px; width: 150px;"
									class="button_blue" value="注册" onclick="register()" />
							</div>

						</li>
					</ul>
				</form>
			</div>
		</div> -->
		<!--注册end-->
	</div>
	<div class="jianyi">*推荐使用ie8或以上版本ie浏览器或Chrome内核浏览器访问本站</div>
</body>
</html>